package buaa.leetcode.Bit;

public class SingleNum2 {
	public static int singleNumber(int[] nums) {
		int[] bitNum = new int[32];
        int result = 0;
        for( int i = 0; i < 32; i++){
        	for( int j = 0; j < nums.length ;j++){
        		bitNum[i] += (nums[j] >> i) & 1; 
        	} 
        	result |= (bitNum[i] % 3) << i;
        }
        return result;
    }
	public static void main(String[] args) {
		System.out.println(singleNumber(new int[]{1,1,2,2,3,4,4}));
	}

}
